<?php
class Tree extends Controller {
	public function html() {
		$mUser = new User_model();
		$currUser = $mUser->currUser();
		if(!$currUser) header('Location:/auth/login');
		
		$tpl = 'tree.html';
		
		$platform = $this->get('platform', 'int');
		if($platform) {
			$mRbac = new Rbac_model();
			$data['menu'] = $mRbac->tree($platform, $currUser['uid']);
		} else {
			$data['menu'] = array(
				'group' => array(0 => '我的信息'),
				'node' => array(
					0 => array(
						0 => array(
							'name' => '修改密码',
							'controller' => 'profile/password'
						),
					)
				)
			);
		}
		$this->display($data, $tpl);
	}
}